import com.sun.org.apache.bcel.internal.generic.NEW;

import java.util.stream.IntStream;

/**
 * @Author :sunwei
 * @Description:
 * @Date create in 21:28  2021/5/23
 * @Modified by:
 */
public class TestMain {

    public static void main(String[] args) {
//        SingleThreadVersion test = new SingleThreadVersion();
        MultiThreadVersion test = new MultiThreadVersion();

        IntStream.range(0, 10).forEach((m)->{
            new Thread(()->{
                IntStream.range(0, 100).forEach((i)->{
                    test.produce();
                });
            },m+"号生产者").start();
        });
        IntStream.range(0, 8).forEach((m)-> {
            new Thread(() -> {
                IntStream.range(0, 100).forEach((i) -> {
                    test.consume();
                });
            },m+"号消费者").start();
        });
    }
}
